<style>
    body {
        padding:30px!important;
    }
    .layui-form-label {
    float: none;
    padding: 0;
    display: inline-block;
    width: auto;
    text-align: left;margin-left: 5px;
}

.layui-form-item .layui-input-block {
    margin: 0 auto;
}

.layui-form-item .required::after {
    content: "*";
    color: red;
    position: absolute;
    margin-left: 4px;
    font-weight: bold;
    line-height: 0.8em;
    top: 6px;
    right: -8px;
}

.layui-elem-quote {
    line-height: .6;
    border-left: 5px solid #1890ff;
    color: #1890ff;
    padding: 10px;
}

.block {
    display: -webkit-box;
    display: flow-root;
}
</style>
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">CURD</li>
        <li>菜单</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-row">
                <form class="layui-form" lay-filter="form">
                    <blockquote class="layui-elem-quote">基础配置</blockquote>
                    <div class="block">
                        <div class="layui-col-sm3">
                            <div class="layui-form-item"> <label class="layui-form-label required   "> 数据库驱动 </label>
                        <div class="layui-input-block">
                        <select name="driver" data-value="mysql" value="mysql" id="driver" data-verify="required" lay-verify="required" lay-vertype="tips" lay-filter="driver" data-attr="" data-id="driver" data-name="driver" class="layui-select-url layui-select ">
                            <option value="">请选择</option>
                            <option selected="" value="mysql">mysql</option>
                        </select><div class="layui-unselect layui-form-select"><div class="layui-select-title"><input type="text" placeholder="Select" value="mysql" readonly="" class="layui-input layui-unselect"><i class="layui-edge"></i></div><dl class="layui-anim layui-anim-upbit" style=""><dd lay-value="" class="layui-select-tips">Select</dd><dd lay-value="mysql" class="layui-this">mysql</dd></dl></div>
                        <div class="layui-form-mid layui-word-aux"> 数据库驱动 </div>
                        </div>
                    </div>
                        </div>
                        <div class="layui-col-sm3">
                            <div class="layui-form-item "><label class="layui-form-label    "> 应用 </label>
                            <div class="layui-input-block">
                                 <div class="layui-input-wrap">
                                    <input type="text" name="app" data-value="" value="" id="app" lay-affix="clear" data-id="app" data-name="app" lay-filter="app" autocomplete="off" class="layui-input     ">
                                     <div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div>
                                 </div>
                                <div class="layui-form-mid layui-word-aux"> 默认生成到admin目录，填写app名字则生成到app目录下面 </div> 
                            </div>
                            </div>
                        </div>
                        <div class="layui-col-sm3">
                            <div class="layui-form-item "><label class="layui-form-label    "> 插件名 </label>
                            <div class="layui-input-block">
                                <div class="layui-input-wrap">
                                    <input type="text" name="addon" data-value="" value="" id="addon" lay-affix="clear" data-id="addon" data-name="addon" lay-filter="addon" autocomplete="off" class="layui-input     ">
                                    <div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div>
                                </div>
                                <div class="layui-form-mid layui-word-aux"> 插件目录名，如果填写则生成到addons目录下面 </div> 
                            </div>
                            </div>
                        </div>
                        <div class="layui-col-sm3">
                             <div class="layui-form-item "><label class="layui-form-label    "> 菜单名称 </label>
                                <div class="layui-input-block">
                                    <div class="layui-input-wrap">
                                        <input type="text" name="menuname" data-value="" value="" id="menuname" lay-affix="clear" data-id="menuname" data-name="menuname" lay-filter="menuname" autocomplete="off" class="layui-input     ">
                                        <div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div>
                                    </div>
                                <div class="layui-form-mid layui-word-aux"> 菜单名称,不填则默认为控制器名或app名 </div> 
                            </div></div>
                        </div>
                    </div>
                    <blockquote class="layui-elem-quote">主表</blockquote>
                    <div class="block">
                        <div class="layui-col-sm3">
                         <div class="layui-form-item "><label class="layui-form-label    "> 主表 </label>
                           <select name="table" data-value="" value="" id="table" data-verify="required" lay-verify="required" lay-vertype="tips" lay-filter="table" data-attr="" data-id="table" data-name="table" class="layui-select-url layui-select  table ">
                                <option value="">Select</option>
                                 <option value="mango_goods">mango_goods</option>
                            </select>
                            </div>
                        </div>
                        <div class="layui-col-sm3">
                            <div class="layui-form-item "><label class="layui-form-label    "> 控制器 </label>
                            <div class="layui-input-block">
                            <div class="layui-input-wrap"><input type="text" name="controller" data-value="" value="" id="controller" lay-affix="clear" data-id="controller" data-name="controller" lay-filter="controller" autocomplete="off" class="layui-input     "><div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div></div>
                            <div class="layui-form-mid layui-word-aux"> 默认表名 </div> 
                            </div></div>
                        </div>
                        <div class="layui-col-sm3">
                           <div class="layui-form-item "><label class="layui-form-label    "> 模型名 </label>
                            <div class="layui-input-block">
                            <div class="layui-input-wrap"><input type="text" name="model" data-value="" value="" id="model" lay-affix="clear" data-id="model" data-name="model" lay-filter="model" autocomplete="off" class="layui-input     "><div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div></div>
                            <div class="layui-form-mid layui-word-aux"> 默认表名 </div> 
                            </div></div>
                        </div>
                        <div class="layui-col-sm3">
                            <div class="layui-form-item"> <label class="layui-form-label    "> 显示字段 </label>
                        <div class="layui-input-block">
                        <select name="fields" data-value="" value="" id="fields" data-multiple="1" data-attr="" data-id="fields" data-name="fields" lay-filter="fields" class="layui-select-url layui-select   fields" multiple="multiple">
                            <option value="">Select</option>
                            
                        </select>
                        <div class="layui-form-mid layui-word-aux"> 显示字段 </div>
                        </div>
                    </div>
                        </div>
                    </div>
                    <blockquote class="layui-elem-quote">
                        <input type="button" value="追加关联" class="addRelation layui-btn layui-btn-xs layui-bg-blue">
                    </blockquote>
                    <div class="block">
                        <div style="display:block">

                            <table class="layui-table">
                                <colgroup>
                                    <col class="layui-col-xs-2">
                                    <col class="layui-col-xs-2">
                                    <col class="layui-col-xs-2">
                                    <col class="layui-col-xs-2">
                                    <col class="layui-col-xs-2">
                                    <col class="layui-col-xs-2">
                                </colgroup>
                                <thead>
                                <tr>
                                    <th class="required">关联表</th>
                                    <th class="required">关联类型</th>
                                    <th class="required">下拉字段</th>
                                    <th class="required">关联外键</th>
                                    <th class="required">关联主键</th>
                                    <th class="required">操作</th>
                                </tr>
                                </thead>
                                <tbody id="relTab">
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div style="margin-top:20px;">

                    </div>
                    <blockquote class="layui-elem-quote">其它设置</blockquote>
                    <div class="block">
                        <div class="layui-col-sm3">
                            <div class="layui-form-item "><label class="layui-form-label    "> 忽略字段 </label>
        <div class="layui-input-block">
         <div class="layui-input-wrap"><input type="text" name="ignoreFields" data-value="" value="" id="ignoreFields" lay-affix="clear" data-id="ignoreFields" data-name="ignoreFields" lay-filter="ignoreFields" autocomplete="off" class="layui-input     "><div class="layui-input-affix layui-input-suffix layui-hide"><i class="layui-icon layui-icon-clear"></i></div></div>
         <div class="layui-form-mid layui-word-aux"> 忽略字段用英文逗号分隔 </div> 
         </div></div>
                        </div>
                        <div class="layui-col-sm3">
                           <div class="layui-form-item"> <label class="layui-form-label    "> 方法 </label>
    <div class="layui-input-block">
      <select name="method" data-value="" value="" id="method" data-multiple="1" lay-search="" data-attr="" data-id="method" data-name="method" lay-filter="method" class="layui-select-url layui-select" multiple="multiple">
        <option value="">Select</option>
        <option value="index">index</option><option value="add">添加</option><option value="edit">编辑</option><option value="destroy">删除</option><option value="delete">销毁</option><option value="deleteAll">deleteAll</option><option value="import">导入</option><option value="export">导出</option><option value="recycle">回收站</option><option value="restore">还原</option>
      </select>
      <div class="layui-form-mid layui-word-aux"> 不选代表默认全部 </div>
    </div>
</div>
                        </div>
                        <div class="layui-col-sm3">
                            <div class="layui-form-item "><label class="layui-form-label    "> 页面大小 </label>
        <div class="layui-input-block">
         <div class="layui-input-wrap"><input type="text" name="limit" data-value="15" value="15" id="limit" data-verify="" lay-verify="" lay-vertype="tips" lay-affix="clear" data-id="limit" data-name="limit" lay-filter="limit" autocomplete="off" class="layui-input     "><div class="layui-input-affix layui-input-suffix"><i class="layui-icon layui-icon-clear"></i></div></div>
          
         </div></div>
                        </div>


                    </div>
                    <div class="block">
                        <div class="layui-col-sm2">
                            {:form_radio('menu',['no','yes'],['verify'=>'','label'=>'make menu'],1)}
                        </div>
                        <div class="layui-col-sm2">
                            {:form_radio('page',['no','yes'],['verify'=>'','label'=>'isPage'],1)}
                        </div>
                        <div class="layui-col-sm2">
                            {:form_radio('force',['no','yes'],['filter'=>'force','label'=>'force mode'],0)}
                        </div>
                        <div class="layui-col-sm2">
                            {:form_radio('jump',['no','yes'],['verify'=>'','label'=>'jump file'],1)}
                        </div>
                        <div class="layui-col-sm2">
                            {:form_radio('delete',['no','yes'],['filter'=>'delete','label'=>'delete mode'],0)}
                        </div>
                    </div>
                    <input type="hidden" value="1" name="type">
                    {:form_submitbtn(true,['show'=>1])}
                </form>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <form class="layui-form" lay-filter="form">
                <div class="block">
                    {:form_select('controllers',
                    $controllerList,
                    ['verify'=>'required','label'=>'controller', 'tips'=>'controller']
                    ,[],'backend')}
                </div>
                    <div class="layui-col-sm3">
                        {:form_radio('force',['no','yes'],['filter'=>'force','label'=>'force mode'],0)}
                    </div>
                    <div class="layui-col-sm3">
                        {:form_radio('delete',['no','yes'],['filter'=>'delete','label'=>'delete mode'],0)}
                    </div>
                    <input type="hidden" value="2" name="type">
                {:form_submitbtn(true,['show'=>1])}
                </form>
            </div>
    </div>
</div>


<script>
    var list = {:json_encode($list)};
</script>
<script type="text/html" id="tpl">
    <tr id="relTab-{{d.index}}">
        <td class="" >
            <select name="joinTable[{{d.index}}]"
                    id="joinTable-{{d.index}}"  lay-verify="required" lay-filter='jointable'
                    class="layui-select jointable" lay-search>
                <option value="">{:lang('Select')}</option>
                {{#  layui.each(d.table, function(index, item){ }}
                <option value="{{d.table[index]}}">{{d.table[index]}}</option>
                {{# }) }}
            </select>
        </td>
        <td class="">
            <select name="joinMethod[{{d.index}}]"
                    id="joinMethod-{{d.index}}"  lay-verify="required"
                    class="layui-select " lay-search>
                <option value="hasOne">hasOne</option>
                <option value="belongsTo">belongsTo</option>
            </select>
        </td>
        <td class="">
            <select name="selectFields[{{d.index}}]"
                    id="selectFields-{{d.index}}"  lay-verify="required"
                    class="layui-select selectfields" lay-search>
                    <option value="title">title</option>
                    <option value="name">name</option>
            </select>
        </td>
        <td class="">
            <select name="joinForeignKey[{{d.index}}]"
                    id="joinForeignKey-{{d.index}}"  lay-verify="required" value="title"
                    class="layui-select joinforeignkey" lay-search>
            </select>
        </td>
        <td class="">
            <select name="joinPrimaryKey[{{d.index}}]"
                    id="joinPrimaryKey-{{d.index}}"  lay-verify="required"
                    class="layui-select joinprimarykey" lay-search>

            </select>
        </td>

        <td class="">
            <button type="button" id="relTab-delete-{{d.index}}"  class="layui-btn layui-btn-sm layui-btn-danger">
                <i class="layui-icon"></i>
            </button>
        </td>
    </tr>
</script>